<!-- This comment will put IE 6, 7 and 8 in quirks mode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>shark::JaakkolaHeuristic Class Reference</title>
<script type="text/javaScript" src="search/search.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3.0.1/es5/tex-mml-chtml.js"></script>
<script src="../../mlstyle.js"></script>
<link href="../css/besser.css" rel="stylesheet" type="text/css"/>
</head>
<!-- pretty cool: each body gets an id tag which is the basename of the web page  -->
<!--              and allows for page-specific CSS. this is client-side scripted, -->
<!--              so the id will not yet show up in the served source code -->
<script type="text/javascript">
    jQuery(document).ready(function () {
        var url = jQuery(location).attr('href');
        var pname = url.substr(url.lastIndexOf("/")+1, url.lastIndexOf(".")-url.lastIndexOf("/")-1);
        jQuery('#this_url').html('<strong>' + pname + '</strong>');
        jQuery('body').attr('id', pname);
    });
</script>
<body>
    <div id="shark_old">
        <div id="wrap">
            <div id="header">
                <div id="site-name"><a href="../../sphinx_pages/build/html/index.html">Shark machine learning library</a></div>
                <ul id="nav">
                    <li >
                        <a href="../../sphinx_pages/build/html/rest_sources/installation.html">Installation</a>
                    </li>
		    <li >
                        <a href="../../sphinx_pages/build/html/rest_sources/tutorials/tutorials.html">Tutorials</a>
                    </li>
		    <li >
                        <a href="../../sphinx_pages/build/html/rest_sources/benchmark.html">Benchmarks</a>
                    </li>
                    <li class="active">
                        <a href="classes.html">Documentation</a>
                        <ul>
                            <li class="first"></li>
                            <li><a href="../../sphinx_pages/build/html/rest_sources/quickref/quickref.html">Quick references</a></li>
                            <li><a href="classes.html">Class list</a></li>
                            <li class="last"><a href="group__shark__globals.html">Global functions</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </div>
<div id="doxywrapper">
<!--
    <div id="global_doxytitle">Doxygen<br>Documentation:</div>
-->
    <div id="navrow_wrapper">
<!-- Generated by Doxygen 1.9.8 -->
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceshark.html">shark</a></li><li class="navelem"><a class="el" href="classshark_1_1_jaakkola_heuristic.html">JaakkolaHeuristic</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="classshark_1_1_jaakkola_heuristic-members.html">List of all members</a> &#124;
<a href="#pub-methods">Public Member Functions</a>  </div>
  <div class="headertitle"><div class="title">shark::JaakkolaHeuristic Class Reference</div></div>
</div><!--header-->
<div class="contents">

<p>Jaakkola's heuristic and related quantities for Gaussian kernel selection.  
 <a href="classshark_1_1_jaakkola_heuristic.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_jaakkola_heuristic_8h_source.html">shark/Algorithms/JaakkolaHeuristic.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a7ca97a37b35ece86f17396682b77e8ec" id="r_a7ca97a37b35ece86f17396682b77e8ec"><td class="memTemplParams" colspan="2">template&lt;class <a class="el" href="_multi_task_svm_8cpp.html#a0dea9a3a85d327080d9b617903508925">InputType</a> &gt; </td></tr>
<tr class="memitem:a7ca97a37b35ece86f17396682b77e8ec"><td class="memTemplItemLeft" align="right" valign="top">&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classshark_1_1_jaakkola_heuristic.html#a7ca97a37b35ece86f17396682b77e8ec">JaakkolaHeuristic</a> (<a class="el" href="classshark_1_1_labeled_data.html">LabeledData</a>&lt; <a class="el" href="_multi_task_svm_8cpp.html#a0dea9a3a85d327080d9b617903508925">InputType</a>, unsigned int &gt; const &amp;dataset, bool nearestFalseNeighbor=true)</td></tr>
<tr class="separator:a7ca97a37b35ece86f17396682b77e8ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa020badc9e213efd8be49004b8e8a58b" id="r_aa020badc9e213efd8be49004b8e8a58b"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classshark_1_1_jaakkola_heuristic.html#aa020badc9e213efd8be49004b8e8a58b">sigma</a> (double quantile=0.5)</td></tr>
<tr class="separator:aa020badc9e213efd8be49004b8e8a58b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae5e25ff2cd4a047ff31900f1f1aa3b55" id="r_ae5e25ff2cd4a047ff31900f1f1aa3b55"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classshark_1_1_jaakkola_heuristic.html#ae5e25ff2cd4a047ff31900f1f1aa3b55">gamma</a> (double quantile=0.5)</td></tr>
<tr class="separator:ae5e25ff2cd4a047ff31900f1f1aa3b55"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Jaakkola's heuristic and related quantities for Gaussian kernel selection. </p>
<dl class="section user"><dt></dt><dd>Jaakkola's heuristic method for setting the width parameter of the Gaussian radial basis function kernel is to pick a quantile (usually the median) of the distribution of Euclidean distances between points having different labels. The present implementation computes the kernel width \( \sigma \) and the bandwidth <p class="formulaDsp">
\[ \gamma = \frac{1}{2 \sigma^2} \]
</p>
 based on the median or on any other quantile of the empirical distribution.</dd></dl>
<p>By default, only the distance to the closest point with different label is considered. This behavior can be turned off by an option of the constructor. This is faster andin accordance with the original paper. </p>

<p class="definition">Definition at line <a class="el" href="_jaakkola_heuristic_8h_source.html#l00065">65</a> of file <a class="el" href="_jaakkola_heuristic_8h_source.html">JaakkolaHeuristic.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a7ca97a37b35ece86f17396682b77e8ec" name="a7ca97a37b35ece86f17396682b77e8ec"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7ca97a37b35ece86f17396682b77e8ec">&#9670;&#160;</a></span>JaakkolaHeuristic()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class <a class="el" href="_multi_task_svm_8cpp.html#a0dea9a3a85d327080d9b617903508925">InputType</a> &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">shark::JaakkolaHeuristic::JaakkolaHeuristic </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classshark_1_1_labeled_data.html">LabeledData</a>&lt; <a class="el" href="_multi_task_svm_8cpp.html#a0dea9a3a85d327080d9b617903508925">InputType</a>, unsigned int &gt; const &amp;&#160;</td>
          <td class="paramname"><em>dataset</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>nearestFalseNeighbor</em> = <code>true</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Constructor </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">dataset</td><td>vector-valued input data </td></tr>
    <tr><td class="paramname">nearestFalseNeighbor</td><td>if true, only the nearest neighboring point with different label is considered (default true) </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="_jaakkola_heuristic_8h_source.html#l00072">72</a> of file <a class="el" href="_jaakkola_heuristic_8h_source.html">JaakkolaHeuristic.h</a>.</p>

<p class="reference">References <a class="el" href="group__shark__globals.html#ga63e2615845814fee2e8b5773a9d4048f">shark::LabeledData&lt; InputT, LabelT &gt;::elements()</a>, <a class="el" href="group__shark__globals.html#gae537f0e90beb970397cd7bb9250984e2">shark::inputDimension()</a>, <a class="el" href="group__shark__globals.html#ga1fee3b5830ae11a78109e8c0265c6569">shark::numberOfClasses()</a>, and <a class="el" href="group__shark__globals.html#ga5333445992cd6b14392cd80a1ab5403c">shark::LabeledData&lt; InputT, LabelT &gt;::numberOfElements()</a>.</p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="ae5e25ff2cd4a047ff31900f1f1aa3b55" name="ae5e25ff2cd4a047ff31900f1f1aa3b55"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae5e25ff2cd4a047ff31900f1f1aa3b55">&#9670;&#160;</a></span>gamma()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">double shark::JaakkolaHeuristic::gamma </td>
          <td>(</td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>quantile</em> = <code>0.5</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Compute the given quantile (usually the median) of the empirical distribution of Euclidean distances of data pairs with different labels converted into a value usable as the gamma parameter of the <a class="el" href="classshark_1_1_gaussian_rbf_kernel.html" title="Gaussian radial basis function kernel.">GaussianRbfKernel</a>. </p>

<p class="definition">Definition at line <a class="el" href="_jaakkola_heuristic_8h_source.html#l00186">186</a> of file <a class="el" href="_jaakkola_heuristic_8h_source.html">JaakkolaHeuristic.h</a>.</p>

<p class="reference">References <a class="el" href="classshark_1_1_jaakkola_heuristic.html#aa020badc9e213efd8be49004b8e8a58b">sigma()</a>.</p>

<p class="reference">Referenced by <a class="el" href="_c_svm_grid_search_tutorial_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main()</a>.</p>

</div>
</div>
<a id="aa020badc9e213efd8be49004b8e8a58b" name="aa020badc9e213efd8be49004b8e8a58b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa020badc9e213efd8be49004b8e8a58b">&#9670;&#160;</a></span>sigma()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">double shark::JaakkolaHeuristic::sigma </td>
          <td>(</td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>quantile</em> = <code>0.5</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Compute the given quantile (usually median) of the empirical distribution of Euclidean distances of data pairs with different labels. </p>

<p class="definition">Definition at line <a class="el" href="_jaakkola_heuristic_8h_source.html#l00155">155</a> of file <a class="el" href="_jaakkola_heuristic_8h_source.html">JaakkolaHeuristic.h</a>.</p>

<p class="reference">References <a class="el" href="_exception_8h.html#a73abb5049a0168d72a48e72dda41708b">SHARK_ASSERT</a>.</p>

<p class="reference">Referenced by <a class="el" href="classshark_1_1_jaakkola_heuristic.html#ae5e25ff2cd4a047ff31900f1f1aa3b55">gamma()</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>include/shark/Algorithms/<a class="el" href="_jaakkola_heuristic_8h_source.html">JaakkolaHeuristic.h</a></li>
</ul>
</div><!-- contents -->
</div>
</body>
</html>
